package com.ruoyi.law.utils;

import cn.hutool.extra.spring.SpringUtil;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysUserService;

/**
 * 获取用户信息
 *
 * @author lie
 * @date 2022/11/29
 */
public class UserUtil {

    private static final ISysUserService userService = SpringUtil.getBean(ISysUserService.class);

    /**
     * 获得用户名
     *
     * @param userId 用户id
     * @return {@link String}
     */
    public static String getUserName(Long userId) {
        return userService.getUserName(userId);
    }

    /**
     * 获取用户
     *
     * @param userId 用户id
     * @return {@link SysUser}
     */
    public static SysUser getUser(Long userId) {
        return userService.selectUserById(userId);
    }
}
